package leet.ku._204;

public class Solution {
    public int countPrimes(int n) {
        boolean[] check = new boolean[n];
        int count = 0;
        for (int i = 2; i < n; i++)
        	if (!check[i]) {
        		count++;
        		int j = i * 2;
        		while (j < n) {
        			check[j] = true;
        			j += i;
        		}
        	}
        return count;
    }
}